#ifndef ANIMATIONICON_H
#define ANIMATIONICON_H

#include <QIcon>
#include <QMovie>
#include <QTimer>
#include <QWidget>

namespace Ui {
class AnimationIcon;
}

class AnimationIcon : public QWidget
{
    Q_OBJECT
    Q_PROPERTY(QIcon icon READ icon WRITE setIcon NOTIFY iconChanged)
    Q_PROPERTY(QMovie* movie READ movie WRITE setMovie NOTIFY movieChanged)

public:
    explicit AnimationIcon(QWidget *parent = nullptr);
    ~AnimationIcon();

    void showMovieIcon();
    void showPixmapIcon();


    QIcon icon() const;
    void setIcon(const QIcon &newIcon);

    QMovie *movie() const;
    void setMovie(QMovie *newMovie);

signals:
    void iconChanged();
    void movieChanged();

private:
    Ui::AnimationIcon *ui;
    QTimer *movieIconTimer;
    QTimer *pixmapIconTimer;

    QIcon m_icon;
    QMovie *m_movie = nullptr;
};

#endif // ANIMATIONICON_H

